<template>
  <div ref="top2" class="order"></div>
</template>

<script lang="ts">
export default {
  name: "XLineChart",
};
</script>

<script lang="ts" setup>
import * as echarts from "echarts";
import { ref, onMounted } from "vue";
const top2 = ref();
function top2Charts() {
  const echartsTop2 = echarts.init(top2.value);
  var option = {
    xAxis: {
      boundaryGap: false,
      data: [
        "一月",
        "二月",
        "三月",
        "四月",
        "五月",
        "六月",
        "七月",
        "八月",
        "九月",
        "十月",
        "十一月",
        "十二月",
      ],
    },
    yAxis: {
      show: false,
      // min: 0,
      max: 25,
    },
    series: {
      type: "line",
      data: [10, 5, 12, 18, 7, 8, 20, 25, 14, 17, 18, 16],
      itemStyle: {
        opacity: 0,
      },
      // 显示曲线
      smooth: true,
      // 区域颜色
      areaStyle: {
        color: "#a64ca6",
        opacity: 1,
      },
      // 线样式
      lineStyle: {
        color: "#a64ca6",
      },
    },
    grid: {
      left: 0,
      right: 0,
      top: 5,
      bottom: 0,
    },
  };
  echartsTop2.setOption(option);
}
onMounted(() => {
  top2Charts();
});
</script>

<style scoped>
.order {
  height: 100%;
}
</style>
